//2009/08/30 21:32:27
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class SkiFriction
{
public:
    int bestPosition(string ski, string path)
    {
        int ret = 0;
        for (int i=0; i+ski.size()<path.size(); i++)
        {
            int big = 0;
            for (int j=0; j<ski.size(); j++)
                if ((path[i+j]-'0') + (ski[j]-'0') > big)
                    big = (path[i+j]-'0') + (ski[j]-'0');
            ret += big;
        }
		return ret;
    }
};
